﻿@model GitCandy.Models.TeamModel

@{
    ViewBag.Title = string.Format(SR.Shared_TitleFormat, string.Format(SR.Team_ChooseUserTitle, Model.Name));
}

<h4>@string.Format(SR.Team_ChooseUserTitle, Model.Name)</h4>

@if (Model != null)
{
    <div class="row">
        <div class="col-md-6">
            <div id="chooser"></div>
        </div>
    </div>

    <script type="text/javascript">
        var team = "@Model.Name";
        var chooser_params = [];
        chooser_params.push(
            {
                data: @Html.Raw(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(Model.MembersRole)),
                controller: "Account",
                container: "#chooser",
                add_label: "@SR.Shared_Add",
                del_label: "@SR.Shared_Remove",
                add_action: { url: "@Url.Action("ChooseUser","Team")", query: function (item) { return { name: team, user: item, act: "add" }; } },
                del_action: { url: "@Url.Action("ChooseUser","Team")", query: function (item) { return { name: team, user: item, act: "del" }; } },
                action_array: [
                    {
                        key: "IsAdministrator",
                        on_label: "@SR.Team_ShortAdministrator",
                        off_label: "@SR.Team_ShortNonAdministrator",
                        checked: { url: "@Url.Action("ChooseUser","Team")", query: function (item) { return { name: team, user: item, act: "admin" }; } },
                        unchecked: { url: "@Url.Action("ChooseUser","Team")", query: function (item) { return { name: team, user: item, act: "member" }; } },
                    }
                ]
            });
    </script>
}
@Html.ActionLink(SR.Shared_Back, "Detail", new { Model.Name }, new { @class = "btn btn-default" })
